<%@ page language="java" pageEncoding="UTF-8"%>
<div ng-controller="UserShowController">
	<div class="panel panel-default">
		<div class="panel-heading">
			用户管理
		</div>
		<div class="panel-body">
		
			<div style="position: relative;" class="clearfix">
				<span class="input-group" style="float: left;width:300px;margin-right: 10px;">
					<span class="input-group-addon">账号</span>
					<input type="text" ng-model="search.account" class="form-control" placeholder="账号">
				</span>
				<span class="input-group" style="float: left;width:300px;margin-right: 10px;">
					<span class="input-group-addon">用户名</span>
					<input type="text" ng-model="search.username" class="form-control" placeholder="用户名">
				</span>
				<span style="float: left;">
					<button class="btn btn-default" type="button" ng-click="find(1)"><i class="glyphicon glyphicon-search"></i> 搜索</button>
				</span>
			</div>
			<hr/>
			
			<table class="table table-hover">
				<thead>
					<tr>
						<th>
							ID
						</th>
						<th>
							账号
						</th>
						<th>
							用户名
						</th>
						<th>
							注册时间
						</th>
						<th>
							状态
						</th>
						<th>
							操作
						</th>
					</tr>
				</thead>
				<tbody>
					<tr ng-repeat="user in user.data">
						<td>
							{{user.id}}
						</td>
						<td>
							{{user.account}}
						</td>
						<td>
							{{user.username}}
						</td>
						<td>
							{{user.register_time | formatDate}}
						</td>
						<td>
							<span class="label label-success" ng-show="user.online">在线</span>
							<span class="label label-default" ng-show="!user.online">离线</span>
						</td>
						<td>
							<button type="button" class="btn btn-danger btn-xs" ng-click="kick(user)" ng-show="user.online">
								<i class="glyphicon glyphicon-remove-circle"></i> 踢下线
							</button>
							<div class="btn-group">
								<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
									角色设置
									<span class="caret"></span>
								</button>
								<ul class="dropdown-menu" role="menu">
									<li ng-repeat="role in role">
										<a href="javascript:void(0);" ng-click="updateRole(user,role)">
											{{role.name}}
											<i class="glyphicon glyphicon-ok pull-right" ng-show="user.role==role.id"></i>
										</a>
									</li>
								</ul>
							</div>
						</td>
					</tr>
				</tbody>
			</table>
			
			<paginate page-count="user.page_count" sum="user.data_sum" pn="user.pn" click="find"></paginate>
		</div>
	</div>
</div>